//路由组件

//导入路由模块
import VueRouter from 'vue-router'

//路由懒加载 按需加载对应的路由组件
const HomeContainer = () => import('./comments/tabber/HomeContainer.vue')

const MemContainer = () => import('./comments/tabber/MemContainer.vue')
const CarContainer = () => import('./comments/tabber/CarContainer.vue')
const SearchContainer = () => import('./comments/tabber/SearchContainer.vue')

const newsList = () => import('./comments/newsList/newsList.vue')
const newsInfo = () => import('./comments/newsList/newsInfo.vue')

const photoList = () => import('./comments/photoList/photoList.vue')
const photoInfo = () => import('./comments/photoList/photoInfo.vue')

const shopList = () => import('./comments/shopping/shopList.vue')
const shopInfo = () => import('./comments/shopping/shopInfo.vue')
const goodsInfo = () => import('./comments/shopping/goodsInfo.vue')
const goodsTalk = () => import('./comments/shopping/goodsTalk.vue')

//导入组件模板
//import HomeContainer from './comments/tabber/HomeContainer.vue'

//import MemContainer from './comments/tabber/MemContainer.vue'
//import CarContainer from './comments/tabber/CarContainer.vue'
//import SearchContainer from './comments/tabber/SearchContainer.vue'

//import newsList from './comments/newsList/newsList.vue'
//import newsInfo from './comments/newsList/newsInfo.vue'

//import photoList from './comments/photoList/photoList.vue'
//import photoInfo from './comments/photoList/photoInfo.vue'

/*import shopList from './comments/shopping/shopList.vue'
import shopInfo from './comments/shopping/shopInfo.vue'
import goodsInfo from './comments/shopping/goodsInfo.vue'
import goodsTalk from './comments/shopping/goodsTalk.vue'*/


//创建路由对象
var router = new VueRouter({
    routes: [  //路由匹配规则
        { path:'/', redirect:'/home' },  //redirect 重定向
        { path:'/home', component:HomeContainer }, 

        { path:'/member', component:MemContainer },  
        { path:'/shopcar', component:CarContainer }, 
        { path:'/search', component:SearchContainer }, 
        { path:'/newsList', component:newsList }, 
        { path:'/newsInfo/:id', component:newsInfo },

        { path:'/photos', component:photoList },
        { path:'/photoInfo/:id', component:photoInfo },

        { path:'/shopList', component:shopList },
        { path:'/shopInfo/:id', component:shopInfo },
        { path:'/goodsInfo/:id', name:'goodsInfo', component:goodsInfo },
        { path:'/goodsTalk/:id', name:'goodsTalk', component:goodsTalk },

    ],
    // 覆盖默认的路由高亮的类，默认的类叫做 router-link-active
    linkActiveClass: 'mui-active' 
})

//把路由对象暴露出去
export default router